<template>
  <div>
    <label v-for="(item, index) in arr" :key="index">
      <input type="checkbox" :value="item" v-model="newArr" />{{ item }}
    </label>
    <p>你选中的元素，累加的值和为:{{ num }}</p>
  </div>
</template>

<script>
export default {
  components: {},
  props: {},
  data() {
    return {
      arr: [9, 15, 19, 25, 29, 31, 48, 57, 62, 79, 87],
      newArr: [],
    };
  },
  computed: {
    num() {
      return this.newArr.reduce((sum, item) => item + sum, 0);
    },
  },
  watch: {},
  created() {},
  methods: {},
};
</script>

<style scoped></style>
